feat(graph): add --dependencies-only and --dependents-only flags to graph subset#1253
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
📝 WalkthroughWalkthroughThe Estimated code review effort: 3 (Moderate) | ~20 minutes 🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
@rd4398 @LalatenduMohanty I had a need for this feature this morning to prep some data for an internal conversation. |
|
Tick the box to add this pull request to the merge queue (same as
|
What's the process now for adding things to the merge queue? Do I click the button myself, for example? |
|
@mergify rebase |
🛑 The pull request rule doesn't match anymoreDetailsThis action has been cancelled. |
Add a `--dependencies-only` flag to `graph subset` that restricts the output to the target package and its transitive dependencies, omitting packages that depend on the target. When the flag is active, ROOT is always included to keep the graph rooted, its original edges are not copied (to avoid spurious edges from other top-level packages that happen to be transitive deps of the target), and an artificial ROOT→target edge is added so the subset serializes correctly. Co-Authored-By: Claude <claude@anthropic.com> Signed-off-by: Doug Hellmann <dhellmann@redhat.com>
Add a `--dependents-only` flag to `graph subset` that restricts the output to the target package and its transitive dependents, omitting the target's own dependencies. Using both `--dependents-only` and `--dependencies-only` together is an error. Co-Authored-By: Claude <claude@anthropic.com> Signed-off-by: Doug Hellmann <dhellmann@redhat.com>
955c0d0 to
fca6661
Compare
Summary
--dependencies-onlytograph subset: restricts output to the target package and its transitive dependencies, excluding any packages that depend on the target.--dependents-onlytograph subset: restricts output to the target package and its transitive dependents, excluding the target's own dependencies.Implementation notes
When
--dependencies-onlyis active, ROOT is not reachable via the normal upward traversal, so:ROOT → targetedge is added so the subset serializes correctly.When
--dependents-onlyis active, the upward traversal naturally reaches ROOT, so no special handling is needed.Test plan
test_graph_subset_dependencies_only— target and its deps are included; dependents are not.test_graph_subset_dependencies_only_no_dependents— confirms dependents absent vs full subset.test_graph_subset_dependents_only— target and its dependents are included; target's deps are not.test_graph_subset_dependents_only_and_dependencies_only_are_exclusive— combining both flags exits non-zero with a clear error message.🤖 Generated with Claude Code